package cn.jekun.shop.web.action;

import javax.annotation.Resource;

import net.sf.json.JSONObject;
import cn.jekun.component.base.bean.ErrorMsg;
import cn.jekun.component.base.exceptions.BusinessException;
import cn.jekun.shop.common.service.ShopBaseAction;
import cn.jekun.shop.web.service.ShopDetailService;

/**
 * 商户信息
 * @author twj
 *
 */
@SuppressWarnings("serial")
public class ShopDetailAction extends ShopBaseAction{
	@Resource(name = ShopDetailService.BEAN_NAME)
	protected ShopDetailService shopDetailService;
	/**
	 * 商户信息
	 * @return
	 */
	public String shopDetail(){
		JSONObject jsonObject = null;
		try{
		String shopId = this.request.getParameter("shopId");
		jsonObject = shopDetailService.load(getUserId(),shopId);
	} catch (BusinessException e) {
		// TODO: handle exception
		jsonObject = JSONObject.fromObject(e.getErrorMsg());
	} catch (Exception e) {
		jsonObject = JSONObject.fromObject(new ErrorMsg(e.getMessage()));
		e.printStackTrace();
	}
		return this.writeJson(jsonObject);
	}
}
